package com.booklove.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.booklove.constant.VoluntaryworkStateConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 志愿任务
 * </p>
 *
 * @author author
 * @since 2024-09-22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("voluntarywork")
@ApiModel(value = "Voluntarywork对象", description = "志愿任务")
public class Voluntarywork implements Serializable {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty("PK")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("封面")
    @TableField("picture")
    private String picture;

    @ApiModelProperty("标题")
    @TableField("title")
    private String title;

    @ApiModelProperty("详细内容")
    @TableField("content")
    private String content;

    @ApiModelProperty("志愿任务状态")
    @TableField("voluntary_work_state")
    private Integer voluntaryWorkState;

    @ApiModelProperty("志愿任务的类型：派送...")
    @TableField("voluntary_work_type")
    private Integer voluntaryWorkType;

    @ApiModelProperty("派送任务的id")
    @TableField("deliver_id")
    private Integer deliverId;

    @ApiModelProperty("捐书id")
    @TableField("donate_book_id")
    private Integer donateBookId;

    @ApiModelProperty("创建人")
    @TableField("CREATED_BY")
    private Integer createdBy;

    @ApiModelProperty("创建时间")
    @TableField("CREATED_TIME")
    private LocalDateTime createdTime;

    @ApiModelProperty("更新人")
    @TableField("UPDATED_BY")
    private Integer updatedBy;

    @ApiModelProperty("更新时间")
    @TableField("UPDATED_TIME")
    private LocalDateTime updatedTime;


    public static Voluntarywork createVoluntaryWork(String title, String content, String picture) {
        Voluntarywork voluntarywork = new Voluntarywork();
        voluntarywork.setTitle(title);
        voluntarywork.setContent(content);
        voluntarywork.setPicture(picture);
        voluntarywork.setVoluntaryWorkState(VoluntaryworkStateConstant.WAITING_ACCEPT);
        voluntarywork.setCreatedTime(LocalDateTime.now());
        voluntarywork.setUpdatedTime(LocalDateTime.now());

        return voluntarywork;
    }


}
